<?php

namespace app\mall\validate\address;

use think\Validate;

/**
 * 验证
 */
class Address extends Validate
{
    /**
     * 定义验证规则
     * 格式：'字段名'    =>    ['规则1','规则2'...]
     *
     * @var array
     */
    protected $rule = [
        'consignee' => 'require',
        'phone'     => 'require|mobile',
        'areacode'  => 'require',
        'areatext'  => 'require',
        'default'   => 'in:0,1',
        'address'   => 'require|chsAlphaNum',
        'id'        => 'require|number'
    ];

    protected $field = [
        'title' => '机构名称',
    ];

    /**
     * 定义错误信息
     * 格式：'字段名.规则名'    =>    '错误信息'
     *
     * @var array
     */
    protected $message = [

    ];

    /**
     * 验证场景
     */
    protected $scene = [
        'add'    => ['consignee', 'phone', 'areacode', 'areatext', 'address', 'default'],
        'update' => ['id'],
    ];

}
